﻿using System;
using System.ComponentModel.DataAnnotations;
using Steve.UI.Administration.DataAnnotations;
using Steve.UI.Administration.Resources;

namespace Steve.UI.Administration.Models
{
    public sealed class NewUrlRewriteDetailModel : NewRevisedObjectModel
    {
        [Required]
        [DataType(DataType.Url)]
        [AbsoluteUri]
        //[Description("Fully qualified (incl. scheme and authority) url of the page")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_Url_Name", Description = "UrlRewrite_Url_Description", GroupName = "Basic_GroupName")]
        public Uri Url { get; set; }

        //HACK: Commented for now, this doesn't support null as being ok... [LessThan("End")]
        //[Description("Date and time when the url becomes live.  Blank for immediately live.")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_Start_Name", Description = "UrlRewrite_Start_Description", GroupName = "Basic_GroupName")]
        public DateTime? Start { get; set; }

        //HACK: Commented for now, this doesn't support null as being ok... [GreaterThan("Start")]
        //[Description("Date and time when the url ends being live.  Blank for live indefinitely.")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_End_Name", Description = "UrlRewrite_End_Description", GroupName = "Basic_GroupName")]
        public DateTime? End { get; set; }

        //[DisplayName("Rewrite Order")]
        //[Category("Advanced")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_RewriteOrder_Name", Description = "UrlRewrite_RewriteOrder_Description", GroupName = "Advanced_GroupName")]
        public int RewriteOrder { get; set; }

        //[DisplayName("Pass query string to target?")]
        [DataType("YesNo")]
        //[Category("Advanced")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_PassQueryString_Name", Description = "UrlRewrite_PassQueryString_Description", GroupName = "Advanced_GroupName")]
        public bool PassQueryString { get; set; }

        //[DisplayName("Ignore query string in matching?")]
        [DataType("YesNo")]
        //[Category("Advanced")]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_IgnoreQueryString_Name", Description = "UrlRewrite_IgnoreQueryString_Description", GroupName = "Advanced_GroupName")]
        public bool IgnoreQueryString { get; set; }
        
        [DataType("SiteUrl")]
        [Required]
        [Display(ResourceType = typeof(CommonResources), Name = "UrlRewrite_SiteUrlId_Name", Description = "UrlRewrite_SiteUrlId_Description", GroupName = "Basic_GroupName")]
        public Guid SiteUrlId { get; set; }
    }
}
